<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!--返回错误信息-->
<?php echo validation_errors(); ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <?php
    $title = [
        'title' => '库存管理-库存查询',
    ];
    $this->load->view('/admin/common/header', $title);
    ?>
</head>

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

<!--    头部   侧边菜单-->
    <?php $this->load->view('/admin/common/bodyLeft'); ?>

    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">库存查询</div>
                        </div>
                        <form action="/admin/goods/remove" id="form_admin" method="post">

                        <div class="widget-body  am-fr">
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                                <div class="am-form-group">
                                    <div class="am-btn-toolbar">
                                        <div class="am-g">
                                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                                <div class="am-form-group tpl-table-list-select">
                                                    <select data-am-selected="{btnSize: 'sm'}">
                                                        <option value="option1">所有类别</option>
                                                        <option value="option2">IT业界</option>
                                                        <option value="option3">数码产品</option>
                                                        <option value="option3">笔记本电脑</option>
                                                        <option value="option3">平板电脑</option>
                                                        <option value="option3">只能手机</option>
                                                        <option value="option3">超极本</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                                <div class="am-form-group tpl-table-list-select">
                                                    <select data-am-selected="{btnSize: 'sm'}">
                                                        <option value="option1">所有类别</option>
                                                        <option value="option2">IT业界</option>
                                                        <option value="option3">数码产品</option>
                                                        <option value="option3">笔记本电脑</option>
                                                        <option value="option3">平板电脑</option>
                                                        <option value="option3">只能手机</option>
                                                        <option value="option3">超极本</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                <div class="am-form-group tpl-table-list-select">
                                    <select data-am-selected="{btnSize: 'sm'}">
                                        <option value="option1">所有类别</option>
                                        <option value="option2">IT业界</option>
                                        <option value="option3">数码产品</option>
                                        <option value="option3">笔记本电脑</option>
                                        <option value="option3">平板电脑</option>
                                        <option value="option3">只能手机</option>
                                        <option value="option3">超极本</option>
                                    </select>
                                </div>
                            </div>
                            <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                                <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
<!--                                    <form action="/admin/user/search" method="get">-->
                                    <input type="text" class="am-form-field" name="search" id="search">
                                    <span class="am-input-group-btn">
                                        <a href="javascript:void()" onclick="search123()" class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search">搜索</a>
          </span>
<!--                                    </form>-->
                                </div>
                            </div>
                            <div class="am-u-sm-12">
                                <div class="am-form-group">
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a href="javascript:void();" onclick="yi()" class="am-btn am-btn-default am-btn-danger"><span
                                                        class="am-icon-trash-o"></span> 导出
                                            </a>
                                            <a href="/admin/goods/addView" class="am-btn am-btn-default am-btn-danger"><span
                                                        class="am-icon-trash-o"></span> 修改库存
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-u-sm-12">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black "
                                       id="example-r">
                                    <thead>
                                    <tr>
                                        <tr><th><input type="checkbox" class="checkall" id="checkallBottom">全选</th>
                                        <th>序号</th>
                                        <th>商品编码</th>
                                        <th>商品名称</th>
                                        <th>商品来源</th>
                                        <th>商品规格</th>
                                        <th>商品分类</th>
                                        <th>库存</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php
                                    foreach ($list as $v) {
                                        echo '<tr class="gradeX">
                                            <td>
                                                <label class="am-checkbox-inline">
                                                  <input type="checkbox" value='.$v['id'].' name="del_id[]" class="checkitem">
                                                </label>
                                             </td>
                                             <td>'.$v['id'].'</td>
                                             <td>'.$v['code'].'</td>
                                             <td>'.$v['name'].'</td>
                                              <td>'.$v['scale'].'</td>
                                              <td>'.$v['source'].'</td>
                                             <td>'.$v['category'].'</td>
                                             <td>'.$v['stock'].'</td>
                                            <td>
                                                <div class="tpl-table-black-operation">
                                                 <a href="/admin/goods/editView?id='.$v['id'].'">
                                                        <i class="am-icon-pencil"></i> 编辑
                                                    </a>
                                                 <a href="/admin/goods/remove?id='.$v['id'].'" class="tpl-table-black-operation-del">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            </div>
                                    </tr>';
                                    }
                                    ?>
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-lg-12 am-cf">
                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination" id="paging">
<!--                                        <li class="am-active"><a href="#">1</a></li>-->
                                        <?php
                                        //                                                $page_num = 4; //每页显示多少条
                                        //                                                $totalNum;  //总页数
                                        $num = ceil($totalNum/$pageNum);
                                        @$search = $_GET['search'];
                                        @$page = $_GET['page'] ? $_GET['page'] : 1;

                                        for ($i = 1; $i <= $num; $i++) {
                                            if($search){
                                                if($page == $i){
                                                    echo "<li class='am-active'><a href=?page=".$i."&search=$search>$i</a></li>";
                                                }else{
                                                    echo "<li><a href=?page=".$i."&search=$search>$i</a></li>";
                                                }
                                            }else{
                                                if($page == $i){
                                                    echo "<li class='am-active'><a href=?page=".$i.">$i</a></li>";
                                                }else{
                                                    echo "<li><a href=?page=".$i.">$i</a></li>";
                                                }
                                            }
                                        }
                                        ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script>
    function search123() {
        var v = document.getElementById('search').value;
        console.log(v);

//        console.log(document.getElementById('searchData').value);
        window.location.href='?page=1'+'&search='+v

    }
</script>
<script>
    $(".checkall").click(function() {
        var isChecked = $(this).prop("checked");

        $('.checkitem').each(function () {
            $(".checkitem").prop("checked", isChecked);
        });

    });
</script>
<script src="/assets/js/amazeui.min.js"></script>
<script src="/assets/js/amazeui.datatables.min.js"></script>
<script src="/assets/js/dataTables.responsive.min.js"></script>
<script src="/assets/js/app.js"></script>

</body>

</html>